Responding to Direct-Mode Queries
QuickDraw GX sends theGXJobFormatModeQuery
message to get or set format-mode information. This message only applies to direct-mode printing, which the user can select for printing to a specific printing device such as the ImageWriter II. Direct mode allows for accelerated printing of text for printing devices such as the ImageWriter II; however, illustrations cannot be printed while text direct-mode printing is selected.QuickDraw GX can make various requests through the
GXJobFormatModeQuery
message that you need to respond to, including requests
These requests apply only to text and line printing mode. The
- to get a list of the fonts that are supported for the job
- to get a list of the styles that are supported for the job
- to get the positioning constraints of the job for font sizes and for line drawing
- to set the current font style, which can be chosen from the list of supported styles
GXJobFormatModeQuery
message is described on page 4-59 in the chapter "Printing Messages." For a complete list and description of theGXJobFormatModeQuery
request types, see the chapter "Advanced Printing Features" in Inside Macintosh: QuickDraw GX Printing.The ImageWriter II printer driver overrides the
GXJobFormatModeQuery
message to implement its responses to the queries. Its implementation is theSD_JobFormatModeQuery
function, a portion of which is shown in Listing 3-10.Listing 3-10 Responding to a query about the job format mode
OSErr SD_JobFormatModeQuery( gxQueryType theQuery, void* srcData, void* dstData) { OSErr anErr = noErr; Handle theFonts; Handle theStyles; switch(theQuery) { case gxSetStyleJobFormatCommonStyleQuery: { char *pStyleName; /* fetch the list of supported styles */ anErr = Send_GXFetchTaggedDriverData('STR#', kFormatModeStylesID, &theStyles); require(anErr == noErr, FailedToLoadStyles1); HNoPurge(theStyles); HLock(theStyles); /* Determine which style is being referenced and set the corresponding style (only two styles are currently supported). */ if (**((short **) theStyles) == 2) { /* the correct number of styles are in place */ char whichFace = 0; pStyleName = ((char *) *theStyles) + sizeof(short); if ( IUCompString(pStyleName, (char *) srcData) == 0 ) { /* user wants bold face */ whichFace = bold; } else { /* point to next name in the list */ pStyleName += *pStyleName + 1; if ( IUCompString(pStyleName, (char *) srcData) == 0 ) { /* user wants the underline face */ whichFace = underline; } } /* if user specified a valid face, set it now */ if (whichFace != 0) { SetStyleCommonFace((gxStyle) dstData, GetStyleCommonFace((gxStyle) dstData) | whichFace); } } /* else - something is wrong with our resource */ DisposHandle(theStyles); /* dump temporary handle */ break; }TheSD_JobFormatModeQuery
function is designed as aswitch
statement, with code similar to that of Listing 3-10 (for the gxSetStyleJobFormatCommonStyleQuery request) included for each of the queries. The full version of this function is found in the QuickDraw GX sample code.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help